#DES new decisions#

DES_desert_gambit_category = {
	DES_PER_food_import_from_RUS = {
		icon = GFX_decision_generic_agriculture
		allowed = { always = no }
		cost = 50
		ai_will_do = {
			factor = 100
			modifier = {
				factor = 10
				has_political_power > 100
			}
		}
		available = {

		}
		fire_only_once = yes
		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_food_import_from_RUS "
			FROM = { country_event = DES.26 }
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				add_ideas = PER_DES_food_import_PER_side
				FROM = { add_ideas = PER_DES_food_import_RUS_side }
			}
			if = {
				limit = {
					OR = {
						has_idea = PER_semi_famine
						has_idea = PER_famine_fading
						has_idea = PER_agricultural_funding_idea
					}
				}
				custom_effect_tooltip = PER_decrease_famine_effect
				hidden_effect = { PER_decrease_famine_effect = yes }
			}
			hidden_effect = { activate_targeted_decision = { target = RUS decision = DES_PER_end_food_import_from_RUS } }
		}
	}

	DES_PER_end_food_import_from_RUS = {
		icon = GFX_decision_generic_agriculture
		allowed = { always = no }
		cost = 75
		ai_will_do = {
			factor = 0
		}
		available = {
			has_idea = PER_DES_food_import_PER_side
		}
		fire_only_once = yes
		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_end_food_import_from_RUS"
			FROM = { country_event = DES.27 }
			remove_ideas = PER_DES_food_import_PER_side
			FROM = { remove_ideas = PER_DES_food_import_RUS_side }
		}
	}

	DES_PER_iraqi_administration_question = {
		icon = GFX_decision_eng_trade_unions_demand
		allowed = { always = no }
		cost = 50
		ai_will_do = {
			factor = 100
			modifier = {
				factor = 10
				has_political_power > 100
			}
		}
		available = {
			676 = { 
				is_owned_by = PER
				is_fully_controlled_by = PER
				is_claimed_by = PER
			}
			349 = { 
				is_owned_by = PER
				is_fully_controlled_by = PER
				is_claimed_by = PER
			}
			291 = { 
				is_owned_by = PER
				is_fully_controlled_by = PER
				is_claimed_by = PER
			}
			291 = { 
				is_owned_by = PER
				is_fully_controlled_by = PER
				is_claimed_by = PER
			}
		}
		fire_only_once = yes
		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_iraqi_administration_question"
			country_event = DES.23
		}
	}
	DES_PER_invite_to_economic_sphere = {
		icon = GFX_decision_global_trade

		available = {
			is_faction_leader = yes
			num_of_owned_factories > 49
			FROM = { both_socialist_or_both_not_socialist = yes }
		}

		visible = {
			has_dynamic_modifier = {
    				modifier = PER_charter_of_revival_leader_dyn
			}
			FROM = {
				is_in_economic_sphere = no
				both_socialist_or_both_not_socialist = yes
				has_capitulated = no
				OR = {
					is_subject = no
					is_subject_of = ROOT
				}
				NOT = {
					has_war_with = ROOT
					is_in_faction_with = INT
					is_in_faction_with = ENT
					is_in_faction_with = JAP
					is_in_faction_with = GER
					is_in_faction_with = RUS
					has_country_flag = PER_refused_charter_of_revival
				}
			}
		}

		target_array = subjects
		target_array = faction_members

		target_root_trigger = {
			has_dynamic_modifier = {
    				modifier = PER_charter_of_revival_leader_dyn
			}
		}
		target_trigger = {
			has_dynamic_modifier = {
    				modifier = PER_charter_of_revival_leader_dyn
			}
			FROM = {
				is_in_economic_sphere = no
				both_socialist_or_both_not_socialist = yes
				has_capitulated = no
				OR = {
					is_subject = no
					is_subject_of = ROOT
				}
				NOT = {
					has_war_with = ROOT
					is_in_faction_with = INT
					is_in_faction_with = ENT
					is_in_faction_with = JAP
					is_in_faction_with = GER
					is_in_faction_with = RUS
					has_country_flag = PER_refused_charter_of_revival
				}
			}
		}

		fire_only_once = yes

		ai_will_do = {
			factor = 10
			modifier = {
				factor = 10
				has_political_power > 100
			}
		}

		complete_effect = {
			log = "[GetLogRoot][GetLogFrom]: Decision complete DES_PER_invite_to_economic_sphere"
			FROM = { country_event = DES.17 }
		}
	}

	DES_PER_invite_to_economic_sphere_opec = {
		icon = GFX_decision_global_trade

		available = {
			is_faction_leader = yes
			num_of_owned_factories > 49
			FROM = { both_socialist_or_both_not_socialist = yes }
			has_completed_focus = PER_form_opec
		}

		visible = {
			has_dynamic_modifier = {
    				modifier = PER_charter_of_revival_leader_dyn
			}
			has_completed_focus = PER_form_opec
			FROM = {
				is_in_economic_sphere = no
				both_socialist_or_both_not_socialist = yes
				has_capitulated = no
				OR = {
					is_subject = no
					is_subject_of = ROOT
				}
				NOT = {
					has_war_with = ROOT
					is_in_faction_with = INT
					is_in_faction_with = ENT
					is_in_faction_with = JAP
					is_in_faction_with = GER
					is_in_faction_with = RUS
					has_country_flag = PER_refused_charter_of_revival
				}
				has_resources_in_country = {
    					resource = oil
    					amount > 99
    					extracted = yes
				}
			}
		}


		target_root_trigger = {
			has_dynamic_modifier = {
    				modifier = PER_charter_of_revival_leader_dyn
			}
			has_completed_focus = PER_form_opec
		}
		target_trigger = {
			has_dynamic_modifier = {
    				modifier = PER_charter_of_revival_leader_dyn
			}
			has_completed_focus = PER_form_opec
			FROM = {
				is_in_economic_sphere = no
				both_socialist_or_both_not_socialist = yes
				has_capitulated = no
				OR = {
					is_subject = no
					is_subject_of = ROOT
				}
				NOT = {
					has_war_with = ROOT
					is_in_faction_with = INT
					is_in_faction_with = ENT
					is_in_faction_with = JAP
					is_in_faction_with = GER
					is_in_faction_with = RUS
					has_country_flag = PER_refused_charter_of_revival
				}
			}
		}

		fire_only_once = yes

		ai_will_do = {
			factor = 10
			modifier = {
				factor = 10
				has_political_power > 100
			}
		}

		complete_effect = {
			log = "[GetLogRoot][GetLogFrom]: Decision complete DES_PER_invite_to_economic_sphere"
			FROM = { country_event = DES.17 }
		}
	}

}


DES_iranian_economy_category = {

	DES_PER_upgrade_industry_0_1 = {
		icon = GFX_decision_generic_merge_plant_materiel

		allowed = { always = no }

		cost = 0

		ai_will_do = { factor = 1000 }

		priority = 1500
		available = {
			PER = {
				num_of_owned_factories > 20
				has_idea = PER_state_of_industry_0
			}
		}

		fire_only_once = yes

		modifier = {
		}

		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_upgrade_industry_0_1"
			swap_ideas = {
    				remove_idea = PER_state_of_industry_0
    				add_idea = PER_state_of_industry_1
			}
			hidden_effect = { activate_targeted_decision = { target = PER decision = DES_PER_upgrade_industry_1_2 } }
		}
	}

	DES_PER_upgrade_industry_1_2 = {
		icon = GFX_decision_generic_merge_plant_materiel

		allowed = { always = no }

		cost = 0

		ai_will_do = { factor = 1000 }

		priority = 1500
		available = {
			PER = {
				num_of_owned_factories > 30
				has_idea = PER_state_of_industry_1
			}
		}

		fire_only_once = yes

		modifier = {
		}

		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_upgrade_industry_1_2"
			swap_ideas = {
    				remove_idea = PER_state_of_industry_1
    				add_idea = PER_state_of_industry_2
			}
			hidden_effect = { activate_targeted_decision = { target = PER decision = DES_PER_upgrade_industry_2_3 } }
		}
	}

	DES_PER_upgrade_industry_2_3 = {
		icon = GFX_decision_generic_merge_plant_materiel

		allowed = { always = no }

		cost = 0

		ai_will_do = { factor = 1000 }

		priority = 1500
		available = {
			PER = {
				num_of_owned_factories > 40
				has_idea = PER_state_of_industry_2
			}
		}

		fire_only_once = yes

		modifier = {
		}

		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_upgrade_industry_2_3"
			swap_ideas = {
    				remove_idea = PER_state_of_industry_2
    				add_idea = PER_state_of_industry_3
			}
			hidden_effect = { activate_targeted_decision = { target = PER decision = DES_PER_upgrade_industry_3_4 } }
		}
	}

	DES_PER_upgrade_industry_3_4 = {
		icon = GFX_decision_generic_merge_plant_materiel

		allowed = { always = no }

		cost = 0

		ai_will_do = { factor = 1000 }

		priority = 1500
		available = {
			PER = {
				num_of_owned_factories > 50
				has_idea = PER_state_of_industry_3
			}
		}

		fire_only_once = yes

		modifier = {
		}

		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_upgrade_industry_3_4"
			swap_ideas = {
    				remove_idea = PER_state_of_industry_3
    				add_idea = PER_state_of_industry_4
			}
		}
	}

	DES_PER_focus_on_civilian_construction = {
		icon = GFX_decision_generic_factory

		allowed = { always = no }

		visible = {
			NOT = { has_idea = PER_state_of_industry_5 }
		}
		cost = 50
		ai_hint_pp_cost = 75

		days_remove = 180

		ai_will_do = {
			base = 0
			modifier = {
				add = 15
				has_political_power > 100
			}
			modifier = {
				factor = 0
				has_war = yes
			}
		}

		available = { 
			NOT = { has_country_flag = PER_industry_focus_ongoing }
			NOT = { has_idea = PER_state_of_industry_5 }
		}

		modifier = {
			production_speed_industrial_complex_factor = 0.15
			production_speed_infrastructure_factor = 0.15
			production_speed_synthetic_refinery_factor = 0.15
		}

		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_focus_on_civilian_construction"
			set_country_flag = PER_industry_focus_ongoing
		}
		remove_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_focus_on_civilian_construction"
			clr_country_flag = PER_industry_focus_ongoing
		}
	}

	DES_PER_focus_on_military_construction = {
		icon = GFX_decision_generic_industry

		allowed = { always = no }

		cost = 50
		ai_hint_pp_cost = 75

		days_remove = 180

		ai_will_do = {
			base = 0
			modifier = {
				add = 15
				has_political_power > 100
			}
			modifier = {
				add = 15
				has_war = yes
			}
			modifier = {
				factor = 0
				date < 1938.01.01
			}
		}
		available = { 
			NOT = { has_country_flag = PER_industry_focus_ongoing }
			NOT = { has_idea = PER_state_of_industry_5 }
		}
		modifier = {
			production_speed_arms_factory_factor = 0.15
			production_speed_dockyard_factor = 0.15
			production_speed_fuel_silo_factor = 0.15
		}

		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_focus_on_military_construction"
			set_country_flag = PER_industry_focus_ongoing
		}
		remove_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_focus_on_military_construction"
			clr_country_flag = PER_industry_focus_ongoing
		}
	}

	DES_PER_focus_on_facilities_construction = {
		icon = GFX_decision_FIN_weapon_caches

		allowed = { always = no }

		cost = 50
		ai_hint_pp_cost = 75

		days_remove = 180

		ai_will_do = {
			base = 0
			modifier = {
				add = 15
				has_political_power > 100
			}
			modifier = {
				factor = 0
				date < 1938.01.01
			}
		}
		available = { 
			NOT = { has_country_flag = PER_industry_focus_ongoing }
			NOT = { has_idea = PER_state_of_industry_5 }
		}
		modifier = {
			production_speed_air_base_factor = 0.2
			production_speed_naval_base_factor = 0.2
			production_speed_radar_station_factor = 0.2
			production_speed_rocket_site_factor = 0.2
			production_speed_facility_factor = 0.2
		}

		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_focus_on_facilities_construction"
			set_country_flag = PER_industry_focus_ongoing
		}
		remove_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_focus_on_facilities_construction"
			clr_country_flag = PER_industry_focus_ongoing
		}
	}

	DES_PER_focus_on_logistics_construction = {
		icon = GFX_decision_train

		allowed = { always = no }

		cost = 50
		ai_hint_pp_cost = 75

		days_remove = 180

		available = { 
			NOT = { has_country_flag = PER_industry_focus_ongoing }
			NOT = { has_idea = PER_state_of_industry_5 }
		}
		available = { NOT = { has_country_flag = PER_industry_focus_ongoing } }
		ai_will_do = {
			base = 0
			modifier = {
				add = 15
				has_political_power > 100
			}
		}

		modifier = {
			production_speed_infrastructure_factor = 0.2
			production_speed_rail_way_factor = 0.3
			production_speed_supply_node_factor = 0.3
		}

		complete_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_focus_on_logistics_construction"
			set_country_flag = PER_industry_focus_ongoing
		}
		remove_effect = {
			log = "[GetLogRoot]: Decision complete DES_PER_focus_on_logistics_construction"
			clr_country_flag = PER_industry_focus_ongoing
		}
	}

	DES_PER_implement_tax_reforms = {
		icon = GFX_decision_generic_confiscation
		allowed = { always = no }
		visible = {
			
		}
		cancel_if_not_visible = yes
		available = {
			NOT = { has_idea = PER_budget_5 }
		}
		cost = 50

		days_remove = 90
		days_re_enable = 30
		modifier = { }
		ai_will_do = {
			base = 0
			modifier = {
				add = 50
				PER_at_least_4_budget = no
			}
			modifier = {
				add = 100
				PER_at_least_3_budget = no
			}
			modifier = {
				add = 200
				PER_at_least_2_budget = no
			}
		}
		cancel_trigger = {
			
        	}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_PER_implement_tax_reforms target: [From.GetName]"
			
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_PER_implement_tax_reforms target: [From.GetName]"
			PER_increase_one_reserve_effect = yes
		}
	}

	DES_PER_karun_hydroelectric_dam = {
		icon = hol_drain_water_lines
		allowed = { always = no }
		available = {
			FROM = { is_owned_and_controlled_by = ROOT }
			custom_trigger_tooltip = {
    				tooltip = PER_at_least_3_budget		
				PER_at_least_3_budget = yes
			}
		}
		highlight_states = { highlight_state_targets = { state = 413 } } #Arabistan
		ai_hint_pp_cost = 50
		cost = 50

		state_target = yes
		days_remove = 365
		fire_only_once = yes
		modifier = { consumer_goods_factor = 0.04 }
		ai_will_do = {
			base = 50
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_PER_karun_hydroelectric_dam target: [From.GetName]"

		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_PER_karun_hydroelectric_dam target: [From.GetName]"
			PER_decrease_one_reserve_effect = yes
			add_tech_bonus = {
				name = DES_PER_karun_hydroelectric_dam
				bonus = 1
				uses = 1
				category = industry
			}
			413 = {
				increase_state_category_by_two_levels = yes
				add_building_construction = { type = infrastructure level = 1 }
				add_building_construction = { type = industrial_complex level = 2 }
				custom_effect_tooltip = tooltip_white_line
				add_building_construction = {
					type = dam
					level = 1
					province = 1922
					instant_build = yes
				}
			}
			custom_effect_tooltip = {
				localization_key = building_state_modifier|dam
				INDENT = "    "
			}

		}
	}

	DES_PER_khersan_hydroelectric_dam = {
		icon = hol_drain_water_lines
		allowed = { always = no }
		available = {
			FROM = { is_owned_and_controlled_by = ROOT }
			custom_trigger_tooltip = {
    				tooltip = PER_at_least_3_budget		
				PER_at_least_3_budget = yes
			}
		}
		highlight_states = { highlight_state_targets = { state = 411 } } #isfahan
		ai_hint_pp_cost = 50
		cost = 50

		state_target = yes
		days_remove = 365
		fire_only_once = yes
		modifier = { consumer_goods_factor = 0.04 }
		ai_will_do = {
			base = 50
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_PER_karun_hydroelectric_dam target: [From.GetName]"

		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_PER_karun_hydroelectric_dam target: [From.GetName]"
			PER_decrease_one_reserve_effect = yes
			add_tech_bonus = {
				name = DES_PER_khersan_hydroelectric_dam
				bonus = 1
				uses = 1
				category = industry
			}
			411 = {
				increase_state_category_by_two_levels = yes
				add_building_construction = { type = infrastructure level = 1 }
				add_building_construction = { type = industrial_complex level = 2 }
				custom_effect_tooltip = tooltip_white_line
				add_building_construction = {
					type = dam
					level = 1
					province = 4928
					instant_build = yes
				}
			}
			custom_effect_tooltip = {
				localization_key = building_state_modifier|dam
				INDENT = "    "
			}

		}
	}

	DES_PER_bakhtiari_hydroelectric_dam = {
		icon = hol_drain_water_lines
		allowed = { always = no }
		available = {
			FROM = { is_owned_and_controlled_by = ROOT }
			custom_trigger_tooltip = {
    				tooltip = PER_at_least_3_budget		
				PER_at_least_3_budget = yes
			}
		}
		highlight_states = { highlight_state_targets = { state = 266 } } #tehran
		ai_hint_pp_cost = 50
		cost = 50

		state_target = yes
		days_remove = 365
		fire_only_once = yes
		modifier = { consumer_goods_factor = 0.04 }
		ai_will_do = {
			base = 50
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_PER_bakhtiari_hydroelectric_dam target: [From.GetName]"

		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_PER_bakhtiari_hydroelectric_dam target: [From.GetName]"
			PER_decrease_one_reserve_effect = yes
			add_tech_bonus = {
				name = DES_PER_khersan_hydroelectric_dam
				bonus = 1
				uses = 1
				category = industry
			}
			266 = {
				increase_state_category_by_two_levels = yes
				add_building_construction = { type = infrastructure level = 1 }
				add_building_construction = { type = industrial_complex level = 2 }
				custom_effect_tooltip = tooltip_white_line
				add_building_construction = {
					type = dam
					level = 1
					province = 7985
					instant_build = yes
				}
			}
			custom_effect_tooltip = {
				localization_key = building_state_modifier|dam
				INDENT = "    "
			}

		}
	}

	DES_PER_spread_modern_irrigation_tech = {
		icon = GFX_decision_generic_agriculture
		allowed = { always = no }
		visible = {
			PER = {
				any_owned_state	= { state_category_1to4 = yes }
			}
			check_variable = {
    				PER_modern_irrigation_count < 4
			}
		}
		available = {
			custom_trigger_tooltip = {
    				tooltip = PER_at_least_3_budget		
				PER_at_least_3_budget = yes
			}
		}
		ai_hint_pp_cost = 100
		cost = 75

		days_remove = 180
		modifier = {  }
		ai_will_do = {
			base = 0
			modifier = {
				add = 15
				has_idea = PER_budget_4
			}
			modifier = {
				add = 15
				has_idea = PER_budget_5
			}
			modifier = {
				add = 15
				has_completed_focus = PER_flourishing_exports
			}
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_PER_spread_modern_irrigation_tech target: [From.GetName]"

		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_PER_spread_modern_irrigation_tech target: [From.GetName]"
			PER_decrease_one_reserve_effect = yes
			add_to_variable = {
    				var = PER_modern_irrigation_count
    				value = 1
			}
			random_owned_controlled_state = {
				limit = {
					is_core_of = ROOT
					is_valid_state_for_development = yes
					state_category_1to4 = yes
				}
				increase_state_category_by_one_level = yes
				hidden_effect = { add_manpower = 50000 }
			}
			random_owned_controlled_state = {
				limit = {
					is_core_of = ROOT
					is_valid_state_for_development = yes
					state_category_1to4 = yes
				}
				increase_state_category_by_one_level = yes
				hidden_effect = { add_manpower = 50000 }
			}

		}
	}

	DES_PER_electrify_our_cities = {
		icon = GFX_decision_generic_electricity
		allowed = { always = no }
		visible = {
			PER = {
				any_owned_state	= { state_category_5to8 = yes }
			}
			check_variable = {
    				PER_electrify_city_count < 4
			}
		}
		available = {
			custom_trigger_tooltip = {
    				tooltip = PER_at_least_4_budget		
				PER_at_least_4_budget = yes
			}
		}
		ai_hint_pp_cost = 100
		cost = 75

		days_remove = 180
		modifier = {  }
		ai_will_do = {
			base = 0
			modifier = {
				add = 15
				has_idea = PER_budget_5
			}
			modifier = {
				add = 15
				has_completed_focus = PER_flourishing_exports
			}
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_PER_spread_modern_irrigation_tech target: [From.GetName]"

		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_PER_spread_modern_irrigation_tech target: [From.GetName]"
			PER_decrease_one_reserve_effect = yes
			add_to_variable = {
    				var = PER_electrify_city_count
    				value = 1
			}
			random_owned_controlled_state = {
				limit = {
					is_core_of = ROOT
					is_valid_state_for_development = yes
					state_category_5to8 = yes
				}
				increase_state_category_by_one_level = yes
				hidden_effect = { add_manpower = 100000 }
			}
			random_owned_controlled_state = {
				limit = {
					is_core_of = ROOT
					is_valid_state_for_development = yes
					state_category_5to8 = yes
				}
				increase_state_category_by_one_level = yes
				hidden_effect = { add_manpower = 50000 }
			}

		}
	}

}